#1.定位到2025必看热片
#2.从2020必看片中提取到子页面的地址
#3.请求子页面的链接地址,拿到我们想要的下载地址...

import requests
import re
url = "https://www.dytt8899.com"
# response = requests.get(ul,verify=False) #verify=False 去掉安全验证
response = requests.get(url) #verify=False 去掉安全验证
response.encoding = 'gb2312'
html = response.text
child_list = []

#分析数据
obj = re.compile(r'2025必看热片.*?<ul>(?P<ul>.*?)</ul>',re.S)
obj2 = re.compile(r"<a href='(?P<href>.*?)'",re.S)
obj3 = re.compile(r'◎片　　名(?P<movie>.*?)<br />'
                  r'.*?<td style="WORD-WRAP: break-word" bgcolor="#fdfddf"><a href="(?P<download>.*?)">',re.S)
result = obj.finditer(html)
for item in result:
    ul = item.group('ul')
    href = obj2.finditer(ul)
    for item2 in href:
        child_href = url+item2.group('href')
        # print(child_href)
        child_list.append(child_href)


#提取子页面的内容
for item in child_list:
    response = requests.get(item)
    response.encoding = 'gb2312'
    html = response.text
    # print(html)
    result3 = obj3.finditer(html)
    for item3 in result3:
        movie_name = item3.group('movie')
        download_url = item3.group('download')
        print(movie_name,download_url)